import api from '../../api';
import { message } from 'antd';
export default {
  namespace: 'exchangeRateMessageM',

  state: {},
  effects: {
    //获取汇率信息数据
    *getTableData({ payload, callback }, { call, put }) {
      const res = yield call(api.exchangeRateMessage.getTableData, payload);
      if (res && res.code == 0) {
        callback('success', res.data);
      } else {
        callback('fail');
        message.error(`获取汇率信息数据失败，失败原因：${res?.msg}`);
        console.error(`获取汇率信息数据失败，失败原因：${res?.msg}`, '接口名称： getDataByDate 接口：portfolio-server/exchangeRate/getDataByDate');
      }
    },
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
